$(document).ready(function () {

    $('#data-wrapper select').select0();

    /*查询按钮事件*/
    $('#data-wrapper .btn-4-query').off('click').on('click', function () {
        ajaxSubmitResponseHtm({
            url: 'industryCategory/query.htm',
            method: 'POST',
            data: $('#data-wrapper form').serialize()
        });
    });

    /*修改*/
    $('#data-wrapper .btn-4-modify').off('click').on('click', function () {
        var iid = $(this).data('iid');
        var cid = $(this).data('cid');
        if (!iid || !cid) {
            tipData({message: '请选择要操作的记录', status: 0});
            return;
        }
        ajaxSubmitResponseHtm({
            container: '#pop-wrapper',
            url: 'industryCategory/edit.htm',
            data: 'iid=' + iid + '&cid=' + cid
        });
    });

    /*pageSize变化，从新加载数据*/
    $('#data-wrapper .paging-size-List').off('change').on('change', function () {
        var length = $(this).val();
        $('#data-wrapper form input[name=length]').val(length);
        $('#data-wrapper .btn-4-query').trigger('click');
    });

    /*点击分页按钮，实现翻页功能*/
    $('#data-wrapper .pagination-toolbar a').off('click').on('click', function () {
        var distStart = $(this).data('idx');
        var start = $('#data-wrapper form input[name=start]').val();
        if (start != distStart) {
            $('#data-wrapper form input[name=start]').val(distStart);
            $('#data-wrapper .btn-4-query').trigger('click');
        }
    });

});